import request, {requestString} from '../../utils/request'

/**
 * 获取订单详情
 *
 * @param receiptId
 * @return
 */
export async function getById({ receiptId }) {
    return request(apiPath.mc + "/api/order/" + receiptId, {
        method: 'get'
    });
}

/**
 * 更新订单主界面信息
 *
 * @param orderMainForm
 * @param bindingResult
 * @return
 */
export async function updateOrderMain(data) {
    return request(apiPath.mc + "/api/order/main", {
        method: 'put',
        data
    });
}

/**
 * 更新订单拖车
 *
 * @param odTrailerForm
 * @param bindingResult
 * @return
 */
export async function updateOrderTrailer(data) {
    return request(apiPath.mc + "/api/order/trailer", {
        method: 'put',
        data
    });
}

/**
 * 更新订单报关
 *
 * @param odDeclareForm
 * @param bindingResult
 * @return
 */
export async function updateOrderDeclare(data) {
    return requestString(apiPath.mc + "/api/order/declare", {
        method: 'put',
        data
    });
}

/**
 * 更新订单补料
 *
 * @param odSiForm
 * @param bindingResult
 * @return
 */
export async function updateOrderSi(data) {
    return request(apiPath.mc + "/api/order/odSi", {
        method: 'put',
        data
    });
}

/**
 * 操作确认费用
 *
 * @param id
 * @return
 */
export async function confirmCharge({ id }) {
    return request(apiPath.mc + "/api/order/" + id + "/chargeConfirm", {
        method: 'put',
        id
    });
}

/**
 * 操作取消费用确认
 *
 * @param id
 * @return
 */
export async function cancelChargeConfirm({ id }) {
    return request(apiPath.mc + "/api/order/" + id + "/cancelChargeConfirm", {
        method: 'put',
        id
    });
}

/**
 * 业务审核费用
 *
 * @param id
 * @return
 */
export async function approvalCharge({ id, result, memo }) {
    return request(apiPath.mc + "/api/order/" + id + "/chargeApproval", {
        method: 'put',
        data: { id, result, memo }
    });
}

/**
 * 费用变更新增审核
 *
 * @param id
 * @return
 */
export async function chargeAddApproval(data) {
    return request(apiPath.mc + "/api/order/" + data.id + "/chargeAddApproval", {
        method: 'put',
        data
    });
}

/**
 * 费用变更新增提交
 *
 * @param id
 * @return
 */
export async function addChargeSumit(data) {
    return request(apiPath.mc + "/api/order/" + data.id + "/addChargeSumit", {
        method: 'put',
        data
    });
}

/**
 * 分页查询订单
 *
 * @param serviceType
 * @param orderNo
 * @param soNo
 * @param drBeginTime
 * @param drEndTime
 * @param loadingPort
 * @param destinationPort
 * @param cstName
 * @param status
 * @param gdUserName
 * @param cntrNo
 * @param sealNumber
 * @param page
 * @return
 */
    export async function getListForPage({ serviceType, orderNo, soNo, drBeginTime, drEndTime, loadingPort, destinationPort, cstName, status, ywUser, cntrNo, sealNumber, mblNo, hblNo, page }) {
        return request(apiPath.mc + "/api/orders", {
            method: 'get',
            data: { serviceType, orderNo, soNo, drBeginTime, drEndTime, loadingPort, destinationPort, cstName, status, ywUser, cntrNo, sealNumber, mblNo, hblNo, page: page.page, size: page.size }
        });
    }